﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;

namespace Agresso.Interface.Layer.Domain
{
    public class ChargeTypeAccountMapping
    {
        public long cta_id = 0;
        public string charge_type = string.Empty;
        public string account = string.Empty;


        public string tcrelet_account_name = string.Empty;
        public string tcrelet_account = string.Empty;
        public string tcrelet_tax_account_ovs = string.Empty;
        public string tcrelet_tax_account_singapore = string.Empty;

        public string bareboatrelet_account_name = string.Empty;
        public string bareboatrelet_account = string.Empty;
        public string bareboatrelet_tax_account_ovs = string.Empty;
        public string bareboatrelet_tax_account_singapore = string.Empty;

        public string chartererInv_account_name = string.Empty;
        public string chartererInv_account = string.Empty;
        public string chartererInv_tax_account = string.Empty;

        public string cargorelet_account_IN = string.Empty;
        public string cargorelet_account_IN_name = string.Empty;
        public string cargorelet_account_IN_GST = string.Empty;

        public string cargorelet_account_OUT_Ovs = string.Empty;
        public string cargorelet_account_OUT_Ovs_name = string.Empty;       

        public string cargorelet_account_OUT_SG = string.Empty;
        public string cargorelet_account_OUT_SG_name = string.Empty;
        public string cargorelet_account_OUT_SG_GST = string.Empty;
        public string cargorelet_account_OUT_Ovs_GST = string.Empty;

        public DateTime created_date = new DateTime(1900, 1, 1);
        public DateTime modified_date = new DateTime(1900, 1, 1);

        public ChargeTypeAccountMapping() { }
        public ChargeTypeAccountMapping(SqlDataReader rd)
        {
            cta_id = Convert.ToInt32(rd["cta_id"]);
            charge_type = rd["charge_type"] is DBNull ? charge_type : rd["charge_type"].ToString();
            account = rd["account"] is DBNull ? account : rd["account"].ToString();

            tcrelet_account_name = rd["tcrelet_account_name"] is DBNull ? tcrelet_account_name : rd["tcrelet_account_name"].ToString();
            bareboatrelet_account_name = rd["vcrelet_account_name"] is DBNull ? bareboatrelet_account_name : rd["vcrelet_account_name"].ToString();
            chartererInv_account_name = rd["freighthire_account_name"] is DBNull ? chartererInv_account_name : rd["freighthire_account_name"].ToString();

            tcrelet_account = rd["tcrelet_account"] is DBNull ? tcrelet_account : rd["tcrelet_account"].ToString();
            bareboatrelet_account = rd["vcrelet_account"] is DBNull ? bareboatrelet_account : rd["vcrelet_account"].ToString();
            chartererInv_account = rd["freighthire_account"] is DBNull ? chartererInv_account : rd["freighthire_account"].ToString();

            tcrelet_tax_account_ovs = rd["tcrelet_tax_account"] is DBNull ? tcrelet_tax_account_ovs : rd["tcrelet_tax_account"].ToString();
            bareboatrelet_tax_account_ovs = rd["vcrelet_tax_account"] is DBNull ? bareboatrelet_tax_account_ovs : rd["vcrelet_tax_account"].ToString();

            tcrelet_tax_account_singapore = rd["tcrelet_tax_account_singapore"] is DBNull ? tcrelet_tax_account_singapore : rd["tcrelet_tax_account_singapore"].ToString();
            bareboatrelet_tax_account_singapore = rd["vcrelet_tax_account_singapore"] is DBNull ? bareboatrelet_tax_account_singapore : rd["vcrelet_tax_account_singapore"].ToString();

            chartererInv_tax_account = rd["freighthire_tax_account"] is DBNull ? chartererInv_tax_account : rd["freighthire_tax_account"].ToString();

            cargorelet_account_IN = rd["cargorelet_account_IN"] is DBNull ? cargorelet_account_IN : rd["cargorelet_account_IN"].ToString();
            cargorelet_account_IN_name = rd["cargorelet_account_name_IN"] is DBNull ? cargorelet_account_IN_name : rd["cargorelet_account_name_IN"].ToString();
            cargorelet_account_IN_GST = rd["cargorelet_account_GST_IN"] is DBNull ? cargorelet_account_IN_GST : rd["cargorelet_account_GST_IN"].ToString();

            cargorelet_account_OUT_Ovs = rd["cargorelet_account_OUT_Ovs"] is DBNull ? cargorelet_account_OUT_Ovs : rd["cargorelet_account_OUT_Ovs"].ToString();
            cargorelet_account_OUT_Ovs_name = rd["cargorelet_account_name_OUT_Ovs"] is DBNull ? cargorelet_account_OUT_Ovs_name : rd["cargorelet_account_name_OUT_Ovs"].ToString();
            cargorelet_account_OUT_Ovs_GST = rd["cargorelet_account_GST_OUT_Ovs"] is DBNull ? cargorelet_account_OUT_Ovs_GST : rd["cargorelet_account_GST_OUT_Ovs"].ToString();

            cargorelet_account_OUT_SG = rd["cargorelet_account_OUT_SG"] is DBNull ? cargorelet_account_OUT_SG : rd["cargorelet_account_OUT_SG"].ToString();
            cargorelet_account_OUT_SG_name = rd["cargorelet_account_name_OUT_SG"] is DBNull ? cargorelet_account_OUT_SG_name : rd["cargorelet_account_name_OUT_SG"].ToString();
            cargorelet_account_OUT_SG_GST = rd["cargorelet_account_GST_OUT_SG"] is DBNull ? cargorelet_account_OUT_SG_GST : rd["cargorelet_account_GST_OUT_SG"].ToString();

            created_date = rd["created_date"] is DBNull ? created_date : Convert.ToDateTime(rd["created_date"]);
            modified_date = rd["modified_date"] is DBNull ? modified_date : Convert.ToDateTime(rd["modified_date"]);
        }
        public ChargeTypeAccountMapping(bool fromsoftmar, SqlDataReader rd)
        {
            charge_type = rd["charge_type"] is DBNull ? charge_type : rd["charge_type"].ToString();
        }
        public bool IsValidChargeTypeMapping()
        {
            return account != string.Empty;
        }
    }
}
